package cn.tedu.spring.bean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestUserDao {
    public static void main(String[] args) {
        // 1.创建IoC容器,进行bean对象的扫描创建
        ApplicationContext context = new AnnotationConfigApplicationContext("cn.tedu.spring.bean");
        // 2.获取UserDao 的 bean对象
        UserDao userDao = context.getBean(UserDao.class);
        System.out.println("userDao=" + userDao);
        // 3.获取UserService 的 bean对象
        UserService userService = context.getBean(UserService.class);
        System.out.println("userService=" + userService);
    }
}
